#include <stdio.h>
#include <unistd.h>
#include <string.h>


int main()
{
#define NUM 100
  char bar [NUM+1];
  memset(bar,'\0',sizeof(bar));

  int i=0;
  const char *lable="|/-\\";

  while(i<=100)
  {
    printf("[%-100s][%3d%%][%c]\r",bar,i,lable[i%4]);
    fflush(stdout);
    bar[i]='#';
    i++;
    usleep(50000);
  }
  printf("\n");
}
